<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="embroot.css">
<TITLE>
Decomposing ECLiPSe terms in C++
</TITLE>
</HEAD>
<BODY >
<A HREF="embroot066.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="embroot065.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot068.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc132">B.2</A>&nbsp;&nbsp;Decomposing ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> terms in C++</H2>
The following methods type-check an ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> term and
retrieve its contents if it is of the correct type.
The return code is EC_succeed for successful conversion,
an error code otherwise.
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description">
<B>int EC_word::is_atom(EC_atom *)</B><DD CLASS="dd-description"><BR>
	checks whether the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> pword is an atom, and if so,
	return its atom identifier.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::is_string(char **)</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is a string (or atom) and converts
	it to a C++ string. This string is volatile, ie. it should be copied
	when it is required to survive resuming of ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::is_string(char **, long *)</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is a string (or atom) and converts
	it to a C++ string. This string is volatile, ie. it should be copied
	when it is required to survive resuming of ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>.
	The string's length is returned in the second argument.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::is_long(long *)</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is a word-sized integer,
	and if so, returns it as a C++ long.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::is_double(double *)</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is a floating point number,
	and if so, returns it as an C++ double.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::is_list(EC_word&amp;,EC_word&amp;)</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is a list and if so, returns its head and tail.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::is_nil()</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is nil, the empty list.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::functor(EC_functor *)</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is a compound term and if so,
	returns its functor.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::arg(const int,EC_word&amp;)</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is a compound term and if so,
	returns its nth argument.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::arity()</B><DD CLASS="dd-description"><BR>
	returns the arity of an EC_word if it is a compound term,
	zero otherwise.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::is_handle(const t_ext_type *, t_ext_ptr *)</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is a handle whose method table
	matches the given one, and if so, the data pointer is returned.<BR>
<BR>
<DT CLASS="dt-description"><B>int EC_word::is_var()</B><DD CLASS="dd-description"><BR>
	checks whether the EC_word is a variable.
	Returns EC_succeed if so, EC_fail otherwise.
</DL>
<HR>
<A HREF="embroot066.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="embroot065.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot068.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
